﻿using System;
using System.Text;
using IAM.Interface.Model;
using IAM.Interface.IDAL;
using IAM.Interface.Model.ENUM;
using IAM.Interface.Common.Context;
using IAM.Interface.DAL.Request.Interface;

namespace IAM.Interface.DAL.Request
{
    /// <summary>
    /// 人员权限管理
    /// </summary>
    public class ACIMgnt : AbstractAppType,IACIMgnt
    {
        #region 成员方法
        /// <summary>
        /// 获取权限模型
        /// </summary>
        /// <returns>所有的权限模型</returns>
        public ACMMode GetACIModel()
        {
            //1.实例化RequestContextModel对象
            RequestContextModel rcm = new RequestContextModel(
                ActionType.IDEN_GETACMODEL,
                OperationType.Nullity,
                new NullityObj(),
                (new NullityObj()).GetType(),
                AppType);
            //2.实例化请求端上下文控制对象
            RequestContextControl rcc = new RequestContextControl(rcm);
            //3.发送消息
            string strreturn = rcc.Send();
            //4.接收消息
            object obj = rcc.Incept(strreturn);
            //5.转换通用类的类型

            return (ACMMode)obj;
        }
        /// <summary>
        /// 获取用户权限信息
        /// </summary>
        /// <param name="accountinfo">人员帐号信息</param>
        /// <returns>用户的权限信息</returns>
        public ACI GetUserACI(AccountInfo accountinfo)
        {
            //1.实例化RequestContextModel对象
            RequestContextModel rcm = new RequestContextModel(
                ActionType.IDEN_GETUSERACI,
                OperationType.Nullity,
                accountinfo,
                accountinfo.GetType(),
                AppType);
            //2.实例化请求端上下文控制对象
            RequestContextControl rcc = new RequestContextControl(rcm);
            //3.发送消息
            string strreturn = rcc.Send();
            //4.接收消息
            object obj = rcc.Incept(strreturn);
            //5.转换通用类的类型

            return (ACI)obj;
        }
        /// <summary>
        /// 设置用户权限信息
        /// </summary>
        /// <param name="acisessions">用户的权限信息</param>
        /// <returns>设置后用户权限信息</returns>
        public ACI SetUserACI(ACI aci)
        {
            //1.实例化RequestContextModel对象
            RequestContextModel rcm = new RequestContextModel(
                ActionType.IDEN_SETUSERACI,
                OperationType.Nullity,
                aci,
                aci.GetType(),
                AppType);
            //2.实例化请求端上下文控制对象
            RequestContextControl rcc = new RequestContextControl(rcm);
            //3.发送消息
            string strreturn = rcc.Send();
            //4.接收消息
            object obj = rcc.Incept(strreturn);
            //5.转换通用类的类型

            return (ACI)obj;
        }
        #endregion
    }
}
